<cfscript>
/** 
* DataBase Frameworks - Sequence
* 
* @hint "DataBase Frameworks - Sequence - Course"
*/ 

component 
	displayname="public.service.db.senate.sequence.Course" 
	output=false 
	accessors=true 
	{

	
	/**
	* @hint "初始化对象"
	*/
	public function init() output=false {
		return this;
	}
	
	/**
	* @hint "自定义主键规则"
	*/
	public string function getID() output=false {
		
		var nextID = "";
		var sql = "SELECT a.cid 
					FROM t_course a 
					ORDER BY a.cid DESC";
		var queryObj = new Query( datasource=application.dnsMaster,maxRows=1  ); 
		var rs_check = queryObj.execute(sql=sql).getResult();
		/* 
			主键生成规则 CHAR(6)
			
			1起头 5位为流水号 本序列代码代表本、专科课程系列
		*/
		if (rs_check.recordCount) {
			/* 创建一个追加id */
			nextID = rs_check["cid"][1] + 1;
			
		}

		return nextID;

	}

}

</cfscript>